﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EuroManager.Domain.Simulator.Engine;
using EuroManager.Domain.Simulator.Engine.Movements;
using NUnit.Framework;

namespace EuroManager.Domain.Simulator.Tests.Engine.Movements
{
    [TestFixture]
    public class HitMovementTests
    {
        [Test]
        public void ShouldAdvanceLocation()
        {
            HitMovement movement = new HitMovement(new Vector2D(1, 2), new Vector2D(-1, 3));
            movement.Update(0.25f);

            Assert.IsTrue(movement.Location.X < 1 && movement.Location.Y > 2);
        }

        [Test]
        public void ShouldEstablishVelocity()
        {
            Vector2D velocity = new Vector2D(-2, 1);
            HitMovement movement = new HitMovement(new Vector2D(3, -5), velocity);

            Assert.AreEqual(velocity, movement.Velocity);
        }

        [Test]
        public void ShouldFinishAfterHit()
        {
            HitMovement movement = new HitMovement(new Vector2D(1, 2), new Vector2D(-1, 3));
            movement.Update(0.25f);

            Assert.IsTrue(movement.IsFinished);
        }

        [Test]
        public void ShouldNotFinishBeforeHit()
        {
            HitMovement movement = new HitMovement(new Vector2D(1, 2), new Vector2D(-1, 3));

            Assert.IsFalse(movement.IsFinished);
        }
    }
}
